import request, {RequestMethod} from "@/utils/request.ts";

/**
 * 获取验证码
 */
export function getCaptchaImageUrl() {
    return request({
        url: '/captchaImage',
        method: RequestMethod.GET,
    });
}



/**
 * 生成二维码
 */
export function generateQrCode() {
    return request({
        url: '/qrcode',
        method: RequestMethod.GET,
    });
}

/**
 * 检查扫码状态
 * @param qrCodeId
 */
export function checkQrCodeStatus(qrCodeId: string) {
    return request({
        url: `/qrcode/status/${qrCodeId}`,
        method: RequestMethod.GET,
    });
}


/**
 * 确认扫码登录
 * @param qrCodeId
 * @param username
 * @param password
 */
export function confirmQrCodeLogin(qrCodeId: string, username: string, password: string) {
    return request({
        url: `/qrcode/confirm?qrCodeId=${qrCodeId}&username=${username}&password=${password}`,
        method: RequestMethod.POST,
        // data: {
        //     qrCodeId,
        //     username,
        //     password,
        // },
    });
}
